Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Terror.ensureError in favor of Terror.createError #29

Closed
wants to merge 1 commit into from

Conversation

narqo
Copy link

@narqo narqo commented Jul 20, 2015

closes #28

  • use Terror.createError(code, err) instead of Terror.ensureError(err, code)
  • add support for Terror.createError(terrInstance)
  • add tests
  • fix typos

/cc @kaero

use Terror.createError(code, err) instead of Terror.ensureError(err, code)

add support for Terror.createError(terrInstance)

fix typos
@kaero
Copy link
Contributor

kaero commented Feb 16, 2016

wow

@narqo
Copy link
Author

narqo commented Feb 17, 2016

We've discussed this with @ruslankerimov and desided that ensureError is still useful in scenarios like failed promises resolution.

new Promise((resolve, reject) => {
  try {
    data = JSON.parse(sdata);
  } catch(err) {
      return reject(err);
  }
  data.condition ? resolve(data) : reject(AppError.createError(...));
})
.catch(err => throw AppError.ensureError(err, AppError.CODES.UNKNOWN_ERROR));

@narqo narqo closed this Feb 17, 2016
@narqo
Copy link
Author

narqo commented Feb 17, 2016

But this PR has some additional fixes, I'll cherry-pick them to the separate PRs later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate Terror.ensureError
2 participants